<!doctype html>
<html>
<head>
  <meta charset="UTF-8" />
  <title>{$arc.title}-特色产品-最美乡村</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/css/base.css" />
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/css/detail.css" />
</head>
<body>
<div class="Article">
  <div class="titile">
    <h2>{$arc.title}</h2>
    <b>发布于{$arc.addtime|date='Y-m-d H:i',###}</b> </div>
  <div class="content">
    <p>{$arc.content}</p>

    <!--<eq name="arc.pro_url" value=""><else/><p><a href="{$arc.pro_url}">为乡村拼团</a></p></eq>-->
    <div class="list-pt" >
      <h3 style="margin-bottom:8px; font-weight:normal;"><span style="border-left:2px #ff4400 solid; padding-left:5px; font-size:16px; color:#333;">为乡村拼团</span></h3>
      <!--<ul style="margin:20px 0;border:1px #ccc solid; border-bottom:none;" >-->
        <!--<li style="padding:5px; border-bottom:1px #ccc solid;">-->
          <!--<a href="{$arc.pro_url}" style="display:block; height:110px;">-->
            <!--<div class="pic" style="width:110px; height:110px; float:left;"><img src="__PUBLIC__/wx/images/20180503174913.jpg" style="display:block; width:110px; height:110px;"/></div>-->
            <!--<div class="tit02" style="margin-left:120px; position:relative; height:110px;">-->
              <!--<h4 style="font-weight:normal; font-size:14px; color:#333; line-height:20px; height:40px; overflow:hidden; ">南充冬菜，香味浓郁，美味可口</h4>-->
              <!--<h5 style="height:30px; line-height:30px; font-weight:normal;"><b style="display:inline-block;"><img src="__PUBLIC__/wx/images/20180503152103.jpg" style="display:inline-block; width:30px; height:30px; border-radius:50%; vertical-align:-10px; margin-right:5px;"/></b><i style="font-style:normal; font-size:12px; color:#666;">蒋毅</i><em style="font-style:normal; float:right; font-size:12px; color:#999;">已售212件</em></h5>-->
              <!--<p style="width:100%; height:30px; position:absolute; bottom:0px; line-height:30px;"><em style="font-style:normal; font-size:12px; color:#ff4400;">￥<b style="font-weight:normal; font-size:14px; padding-right:2px;">23.8</b></em><del style="font-size:12px; color:#999;">原价：￥35.8</del><i style="display:inline-block; font-style:normal; background:#ff4400; font-size:12px; color:#fff; padding:0 6px; border-radius:2px; float:right;">去拼团</i></p>-->
            <!--</div>-->
          <!--</a>-->
        <!--</li>-->
      <!--</ul>-->
    </div>
    <!--<div class="list-pt" style="margin:20px 0;">-->

      <!--<ul style="border:1px #ccc solid; border-bottom:none;">-->
        <!--<li style="padding:5px; border-bottom:1px #ccc solid;"> <a href="{$arc.pro_url}" style="display:block; height:110px;">-->
          <!--<div class="pic" style="width:110px; height:110px; float:left;"><img src="__PUBLIC__/wx/images/55.jpg" style="display:block; width:110px; height:110px;"/></div>-->
          <!--<div class="tit02" style="margin-left:120px; position:relative; height:110px;">-->
            <!--<h4 style="font-weight:normal; font-size:14px; color:#333; line-height:20px; height:40px; overflow:hidden; ">恩施富硒有机乌龙茶</h4>-->
            <!--<h5 style="height:30px; line-height:30px; font-weight:normal;"><b style="display:inline-block;"><img src="__PUBLIC__/wx/images/66.jpg" style="display:inline-block; width:30px; height:30px; border-radius:50%; vertical-align:-10px; margin-right:5px;"/></b><i style="font-style:normal; font-size:12px; color:#666;">王实甫</i><em style="font-style:normal; float:right; font-size:12px; color:#999;">已售100件</em></h5>-->
            <!--<p style="width:100%; height:30px; position:absolute; bottom:0px; line-height:30px;"><em style="font-style:normal; font-size:12px; color:#ff4400;">￥<b style="font-weight:normal; font-size:14px; padding-right:2px;">108.8</b></em><del style="font-size:12px; color:#999;">原价：￥138.8</del><i style="display:inline-block; font-style:normal; background:#ff4400; font-size:12px; color:#fff; padding:0 6px; border-radius:2px; float:right;">去拼团</i></p>-->
          <!--</div>-->
        <!--</a> </li>-->
      <!--</ul>-->
    <!--</div>-->
    <!--<h4><span id="supports">{$arc.farming_supports}</span><em>阅读{$arc.farming_clicks}</em></h4>-->
  <!--</div>-->
  <div class="comment">
    <ul>
      <volist name="com" id="vo">
        <li>
          <div class="pic">
            <eq name="vo.img" value=""> <img src="__PUBLIC__/wx/images/pic06.jpg"/>
              <else/>
              <img src="__PUBLIC__/Uploads/{$vo.img}"/> </eq>
          </div>
          <div class="matter">
            <h4><span class="nickname">{$vo.nickname}</span><!--<b>地方贤达</b>-->
              <em class="praise" data="{$vo.comments_id}" sup="{$vo.comments_supports}">{$vo.comments_supports}</em></h4>
            <p>{$vo.content}</p>
            <h5>
              <time>{$vo.addtime|date='Y-m-d',###}</time>
              <eq name="vo.num" value="0"> <a  onClick="replay({$vo.comments_id},'{$vo.nickname}',{$vo.u_id})">回复</a>
                <else/>
                <a href="__MODULE__/Article/reply/id/{$vo.comments_id}/">{$vo.num}条回复</a> </eq>
            </h5>
          </div>
        </li>
      </volist>
    </ul>
  </div>
  <div class="apply">
    <p>
      <input type="hidden" value="{$arc.u_id}" name="r_u_id" />
      <input type="hidden" value="0" name="rid" />
      <input type="text" name="do-comments" placeholder="写评论"/>
      <input type="button" value="发表" onClick="add_comments()"/>
    </p>
  </div>
</div>
<script type="text/javascript" src="__PUBLIC__/wx/js/jquery-1.9.1.js"></script>
<script type="text/javascript">
    //跨域请求特色产品信息
    if('{$arc.pro_url}'){
        var pro_id = "{$arc.pro_url}";//特殊产品链接id
        $.ajax({
            type: "post",//传输方式
            async: true,//是否异步
            url: "http://www.xiangtws.com/index.php/Wx/FarmingSpellgroup/index.html",//跨域地址
            datatype: 'jsonp',//数据格式
            jsonp: "showDate",//jsonp默认为callback
            data: {'id': pro_id},//传输数据
            success: function (d) {
                // console.log(d);
                getResult(JSON.parse(d));//将json字符串转化为数组
            },// 成功后
            error: function () {
                alert("发生异常");
            }//失败后
        });//end ajax
    }//end if

    function getResult(data) {
        var str = '';//拼接html内容
        for(var i = 0;i<data.length;i++){
            str += "<ul style='margin:20px 0;border:1px #ccc solid; border-bottom:none;' >\n" +
                "        <li style='padding:5px; border-bottom:1px #ccc solid;'>\n" +
                "          <a href='http://www.xiangtws.com/index.php/Wx/Prodetail/index/id/"+data[i]['id']+"' style='display:block; height:110px;'>\n" +
                "            <div class='pic' style='width:110px; height:110px; float:left;'><img src='"+data[i]['h_imgs']+"' style='display:block; width:110px; height:110px;'/></div>\n" +
                "            <div class='tit02' style='margin-left:120px; position:relative; height:110px;'>\n" +
                "              <h4 style='font-weight:normal; font-size:14px; color:#333; line-height:20px; height:40px; overflow:hidden; '>"+data[i]['title']+"</h4>\n" +
                "              <h5 style='height:30px; line-height:30px; font-weight:normal;'><b style='display:inline-block;'><img src='"+data[i]['member']['avatar']+"' style='display:inline-block; width:30px; height:30px; border-radius:50%; vertical-align:-10px; margin-right:5px;'/></b><i style='font-style:normal; font-size:12px; color:#666;'>"+data[i]['member']['nickname']+"</i><em style='font-style:normal; float:right; font-size:12px; color:#999;'>已售"+data[i]['actual_num']+"件</em></h5>\n" +
                "              <p style='width:100%; height:30px; position:absolute; bottom:0px; line-height:30px;'><em style='font-style:normal; font-size:12px; color:#ff4400;'>￥<b style='font-weight:normal; font-size:14px; padding-right:2px;'>"+data[i]['actual_price']+"</b></em><del style='font-size:12px; color:#999;'>原价：￥"+data[i]['price']+"</del><i style='display:inline-block; font-style:normal; background:#ff4400; font-size:12px; color:#fff; padding:0 6px; border-radius:2px; float:right;'>去拼团</i></p>\n" +
                "            </div>\n" +
                "          </a>\n" +
                "        </li>\n" +
                "    </ul>"
        }//end for
        $(".list-pt").children('h3').after(str);//将拼接内容加入指定元素的后边
    }//end fun
</script>
<script type="text/javascript">
    //文章增减-点赞
    $("#supports").click(function(){
        if($(this).hasClass("zan")){
            $(this).removeClass("zan");
            $.get("__MODULE__/Article/farming_supports/id/{$arc.farming_id}/dowhat/dec/");
            $("#supports").text(Number($("#supports").text())-1);
        }else{
            $(this).addClass("zan");
            $.get("__MODULE__/Article/farming_supports/id/{$arc.farming_id}/dowhat/add/");
            $("#supports").text(Number($("#supports").text())+1);
        }
    });
    //评论增减-点赞
    $(".praise").click(function(){
        id=$(this).attr('data');//获取点赞的id
        if($(this).hasClass("praised")){
            $.get("__MODULE__/Article/comments_supports/id/"+id+"/dowhat/dec/");
            $(this).text(Number($(this).attr('sup')));
            $(this).removeClass("praised");
        }else{
            $.get("__MODULE__/Article/comments_supports/id/"+id+"/dowhat/add/");
            $(this).text(Number($(this).attr('sup'))+1);
            $(this).addClass("praised");
        }
    });
    //评论
    function add_comments(){
        if($("input[name='do-comments']").val()==''){alert("请输入评论！");return;}
        //增加，更新地址
        $.ajax({
            type : "POST",
            dataType : "json",
            data:{r_u_id:$("input[name='r_u_id']").val(),arc_type:'farming',arc_id:'{$arc.farming_id}',r_id:$("input[name='rid']").val(),content:$("input[name='do-comments']").val()},
            url: "__MODULE__/Article/comments/",
            async:false,
            success: function(data){
                if(data=='ok'){
                    //alert("添加成功");
                    location.reload();
                }else{
                    alert(data);
                }
            }
        });//end ajax
    }//end
    function replay(id,nickname,r_u_id){
        $("input[name='rid']").val(id);
        $("input[name='r_u_id']").val(r_u_id);
        $("input[name='do-comments']").attr("placeholder","回复："+nickname);
    }//end fun
</script>
</body>
</html>